// ================================================================================
// 		File: PartyJoinReviewOption.cs
// 		Desc: 
//  
// 		Called by:   
//               
// 		Auth: chenwenzhi（--）
// 		Date: 2015-12-28 23:59
// ================================================================================
// 		Change History
// ================================================================================
// 		Date:		Author:				Description:
// 		--------	--------			-------------------
//    
// ================================================================================
// 
// ================================================================================
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;

namespace ZHDJ.Data.Models.JoinParty
{
    /// <summary>
    /// 
    /// </summary>   
    public class PartyJoinReviewOption : EntityBase
    {
        #region 属性
        /// <summary>
        /// StandID
        /// </summary>
        [StringLength(128)]
        public string StandID { get; set; }

        /// <summary>
        /// LoginID
        /// </summary>
        [StringLength(128)]
        public string LoginID { get; set; }

        /// <summary>
        /// LoginName
        /// </summary>
        [StringLength(128)]
        public string LoginName { get; set; }

        /// <summary>
        /// 培养措施
        /// </summary>
        public string ContactContent { get; set; }

        /// <summary>
        /// 半年考察情况
        /// </summary>
        public string PartyGroupContent { get; set; }

        /// <summary>
        /// PartyBranchContent
        /// </summary>
        public string PartyBranchContent { get; set; }

        /// <summary>
        /// CreateTime
        /// </summary>
        public DateTime? CreateTime { get; set; }

        /// <summary>
        /// OptionTime
        /// </summary>
        public DateTime? OptionTime { get; set; }

        /// <summary>
        /// ContactTime
        /// </summary>
        public DateTime? ContactTime { get; set; }

        public string StepID { get; set; }

        public string Remark { get; set; }

        public string BranchOpinion { get; set; }
        public string CultureMeasures { get; set; }
        public string OpinionOne { get; set; }
        public string OpinionTwo { get; set; }
        public string OpinionThree { get; set; }
        public string OpinionFour { get; set; }
        public string OpinionFive { get; set; }
        public string OpinionSix { get; set; }

        public DateTime? OpinionOneCreateTime { get; set; }
        public DateTime? OpinionTwoCreateTime { get; set; }
        public DateTime? OpinionThreeCreateTime { get; set; }
        public DateTime? OpinionFourCreateTime { get; set; }
        public DateTime? OpinionFiveCreateTime { get; set; }
        public DateTime? OpinionSixCreateTime { get; set; }

        public string AppllicationID { get; set; }

        #endregion

        #region 查询管理
        /// <summary>
        /// 获取GetDataGrid数据源
        /// </summary>
        /// <returns></returns>
        public static DataSet GetGridData(string StandID)
        {
            StringBuilder sbSql = new StringBuilder();
            sbSql.AppendFormat(@"SELECT data.ContactTime,data.OptionTime,data.StandID,data.ID,data.LoginID,data.LoginName,m.UserName,b.BranchName,
                                data.ContactContent,data.PartyGroupContent,
                                data.PartyBranchContent,data.CreateTime,
                                case ifnull(PartyGroupContent,'') when '' then '填写' else '查看' end as GroupContentName,
                                case ifnull(PartyBranchContent,'') when '' then '填写' else '查看' end as BranchContentName,
                                case ifnull(ContactContent,'') when '' then '填写' else '查看' end as ContactContentName,
                                case ifnull(PartyGroupContent,'') when '' then 'add' else 'look' end as GroupContentSign,
                                case ifnull(PartyBranchContent,'') when '' then 'add' else 'look' end as BranchContentSign,
                                case ifnull(ContactContent,'') when '' then 'add' else 'look' end as ContactContentSign
                                from tblPartyJoinReviewOption data
                                left join tblPartyJoinLinkExample LE on data.StandID=LE.StandID
                                left join tblPartyJoinApplycation m on(LE.AppllicationID=m.AppllicationID)
                                left join tblPartyOrgBranch b on(m.BranchID=b.BranchID)
                                where 1=1 and data.StandID = '{0}'", StandID);
            sbSql.Append(" order by data.OptionTime ");
            return MySqlHelper.ExecuteDataSet(sbSql.ToString());
        }
        #endregion

    }
}
